<?php
###
#  Baing PHP 框架 1.0.0
#  http://baing.co/
#
#  Copyright: 白晓阳
#  License: CC BY-NC-SA 4.0
#  https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh
###

namespace bai\action;

use bai\resource\application\Upload as UploadApp;


class Upload extends \bai\Action
{
    public function run()
    {
        $resource = self::$process->resource ?: UploadApp::RESOURCE_DEFAULT;
        $result = UploadApp::setup()?->run([
            'resource' => $resource,
            $resource => self::$request->query[$resource] ?? ''
        ]);
        if ($result['status']) {
            return $this->next($result['result'] ?? []);
        }
        return $this->exit($result['result'] ?? []);
    }
}
